package me.feng.dao

import org.hibernate.cfg.Configuration
import org.hibernate.Session
import org.hibernate.cfg.AnnotationConfiguration
import org.hibernate.Query


object SessionFactoryHelper{
  lazy val  sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory()
  var _session:Session = _
  def getSession = if(_session!=null && _session.isOpen()) _session else sessionFactory.openSession()
  
}